package com.zimin.cloud.system.controller.api;


import com.zimin.cloud.mine.pojo.system.business.LoginBO;
import com.zimin.shared.annotation.OpLog;
import com.zimin.shared.enums.ModuleEnum;
import com.zimin.shared.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户信息 前端控制器 接口
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:04
 */
@RequestMapping("/sys/login")
@Api(value = "登录API", tags = {"登录API"})
public interface ILoginController {

    /**
     * <p>用户登录</p>
     *
     * @param loginBO 登录信息
     * @return com.zimin.shared.pojo.Result
     * @since 2022-04-18 10:12:19
     */
    @PostMapping
    @OpLog(module = ModuleEnum.SYSTEM, action = "用户登录")
    @ApiOperation(value = "用户登录", notes = "用户登录", httpMethod = "POST")
    Result login(@RequestBody @Validated LoginBO loginBO);

    /**
     * <p>人脸识别登录</p>
     *
     * @param loginBO 登录信息
     * @return com.zimin.shared.pojo.Result
     * @since 2022-04-18 10:12:50
     */
    @PostMapping("/face")
    @OpLog(module = ModuleEnum.SYSTEM, action = "人脸登录")
    @ApiOperation(value = "人脸登录", notes = "人脸登录", httpMethod = "POST")
    Result faceLogin(@RequestBody LoginBO loginBO) throws Exception;

    /**
     * <p>根据登录信息获取用户信息</p>
     *
     * @param userId 用户ID
     * @param token  登录标识
     * @return com.zimin.shared.pojo.Result
     * @since 2022-04-18 10:13:05
     */
    @GetMapping("/{userId}/{token}")
    Result getLoginInfoById(@PathVariable(value = "userId") String userId,
                            @PathVariable(value = "token") String token);

}
